//补0操作
function getzf(num) {
	if (parseInt(num) < 10) {
		num = '0' + num;
	}
	return num;
}
//转换年月日方法
function getDateMy(format, str) {
	let oTime = null;
	let newStr = str * 1000;
	var oDate = new Date(newStr),
		oYear = oDate.getFullYear(),
		oMonth = oDate.getMonth() + 1,
		oDay = oDate.getDate(),
		oHour = oDate.getHours(),
		oMin = oDate.getMinutes(),
		oSec = oDate.getSeconds()
	if (format == 'yyyy-mm-dd') {
		oTime = oYear + '-' + getzf(oMonth) + '-' + getzf(oDay) + ' ' + getzf(oHour) + '-' + getzf(oMin)+ '-' + getzf(oSec)
	} else if (format == 'yyyy/mm/dd') {
		oTime = oYear + '/' + getzf(oMonth) + '/' + getzf(oDay)
	}
	return oTime;
}

export {getDateMy};